package Bi_Tree.bi_search_tree;

import Bi_Tree.TreeNode;

public class lc700 {
    public TreeNode searchBST(TreeNode root, int val) {
        //递归终止条件
        if (root == null) {
            return root;
        }
        //单层递归逻辑
        //因为是二叉搜索树，应为中序遍历
        if (root.val > val) {
           return searchBST(root.left, val);
        } else if (root.val == val) {
            return root;
        } else {
         return    searchBST(root.right, val);
        }
    }
}
